﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pg.BioMedics.SDR.Caching
{
    /// <summary>
    /// Defines an interface for caching strategies utilized by the 
    /// context
    /// </summary>
    public interface ICachingStrategy<T>
    {
        /// <summary>
        /// Puts an item into the cache. An item will be indexed by its 
        /// unique key. If key already exists in the cache, related item will be replaced
        /// by thie item defined as a parameter
        /// </summary>
        /// <param name="item">Item</param>
        void Put(string key, T item);

        /// <summary>
        /// Checks if given item is already stored in the cache
        /// </summary>
        /// <param name="item">Item</param>
        /// <returns>true - if already in the cache</returns>
        bool Contains(string key);

        /// <summary>
        /// Removes an item defined by the unique key from the cache
        /// </summary>
        /// <param name="key">Items unique key</param>
        void Remove(string key);

        /// <summary>
        /// Removes all items from the store defined by this strategy
        /// </summary>
        void Clear();

        /// <summary>
        /// Gets LINQ IQueryable interface implementation defined by this strategy
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetQueryable();
    }
}
